<?php
defined("_VALID_ACCESS") || die('Direct access forbidden');
    class Eyeworx_Inventory_ContactLensImport_RBO_RBOContactLensImport extends RBO_Recordset {

//        public function display_total($record, $nolink=false) {
//            if (is_array($record)) {
//                $record = record_to_object($record);
//            }
//            $total = $record['total'] = $record['quantity'] * $record['price'];
//            $price_currency =  Utils_CurrencyFieldCommon::get_values($record->total);
//            return Utils_CurrencyFieldCommon::format(round($total,2),$price_currency[1]);
//        }

        public function fields() {
            $fields = array();

            $acc = new RBO_Field_Select('Contact Lens', 'eyeworx_contact_lens', array('contact_lens_brand', 'contact_lens_model'));
            $acc->set_visible()->set_required();
            $fields[] = $acc;

            $style = new RBO_Field_CommonData('Contact Lens Style', 'Type');
            $style->set_required()->set_visible()->set_filter();
            $fields[] = $style;

            $grade = new RBO_Field_CommonData('Contact Lens Grade', 'Type::Contact Lens Style');
            $grade->set_visible()->set_required();
            $fields[] = $grade;

            $color = new RBO_Field_MultiSelect('Contact Lens Color', 'eyeworx_color', array('color_code', 'color_name'));
            $color->set_visible()->set_filter();
            $fields[] = $color;

            $expiration = new RBO_Field_Date('Date of Expiration');
            $expiration->set_required()->set_visible();
            $fields[] = $expiration;

            $date = new RBO_Field_Date('Date Imported');
            $date->set_required()->set_visible();
            $fields[] = $date;

            $quantity = new RBO_Field_Integer('Quantity');
            $quantity->set_required()->set_visible();
            $fields[] = $quantity;

            return $fields;
        }

        public function table_name() {
            return 'eyeworx_contact_lens_imports';
        }

    }
?>